package com.four.order.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.four.order.service.OrderService;
import com.four.order.service.impl.OrderServicelmpl;

@WebServlet("/updateOrder.do")
public class UpdateOrderServlet extends HttpServlet{
	//更新（修改）
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		this.doPost(req, resp);
	}
	
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf-8");
		resp.setCharacterEncoding("UTF-8");
		String id = req.getParameter("id");
		String name = req.getParameter("name");
		String oaddress = req.getParameter("oaddress");
		String createtime = req.getParameter("createtime");
		String ooldprice = req.getParameter("ooldprice");
		String onowprice = req.getParameter("onowprice");
		String count = req.getParameter("count");
		String endtime = req.getParameter("endtime");
		String oflag = req.getParameter("oflag");
		String oremark = req.getParameter("oremark");
		OrderService service = new OrderServicelmpl();
		boolean result = service.updateOrder(id,name,oaddress,createtime, ooldprice, onowprice,count,endtime,oflag,oremark);
		System.out.println("更新结果：" + result);
		req.getRequestDispatcher("###").forward(req, resp);
	}

}
